
//
//  BKExchangeVoucherCell.m
//  bestkeep
//
//  Created by yons on 16/12/5.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "BKExchangeVoucherCell.h"
#import "BKMainCommon.h"
#import "BK_OD_Color.h"

@implementation BKExchangeVoucherCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}
-(void)initUI {
    
    _vouchView = [[UIView alloc]init];
    _vouchView.backgroundColor = RGB(242, 242, 242);
    [self addSubview:_vouchView];
    [_vouchView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top);
        make.left.mas_equalTo(self.mas_left);
        make.right.mas_equalTo(self.mas_right);
        make.bottom.mas_equalTo(self.mas_bottom);
    }];
    
    _greenBV = [UIImageView new];
    UIImage *gImage = [UIImage imageNamed:@"BKIntegral_card"];
    _greenBV.image = gImage;
    [self.vouchView addSubview:_greenBV];
    [_greenBV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.vouchView.mas_top).offset(15);
        make.left.mas_equalTo(self.vouchView.mas_left).offset(ApplicationBackGauge);
        make.width.mas_equalTo(@(gImage.size.width * 90 / gImage.size.height));
        make.bottom.mas_equalTo(self.vouchView.mas_bottom).offset(-15);
    }];
    
    _whiteBV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"BKIntegral_baidi"]];
    [self.vouchView addSubview:_whiteBV];
    [_whiteBV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.vouchView.mas_top).offset(15);
        make.left.mas_equalTo(self.greenBV.mas_right);
        make.right.mas_equalTo(self.vouchView.mas_right).offset(-ApplicationBackGauge);
        make.bottom.mas_equalTo(self.vouchView.mas_bottom).offset(-15);
    }];
    
    _moneyLabel = [[UILabel alloc]init];
    _moneyLabel.textColor = [UIColor whiteColor];
    _moneyLabel.textAlignment = NSTextAlignmentCenter;
    [self.greenBV addSubview:_moneyLabel];
    [_moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.greenBV.mas_centerX);
        make.centerY.mas_equalTo(self.greenBV.mas_centerY);
    }];
    
    _titleLabel = [[UILabel alloc]init];
    _titleLabel.font = [UIFont systemFontOfSize:15];
    //    _titleLabel.numberOfLines = 0;
    _titleLabel.textColor =kOrderBlack1;
    [self.whiteBV addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.whiteBV.mas_left).offset(19);
        make.right.mas_equalTo(self.whiteBV.mas_right).offset(-10);
        make.top.mas_equalTo(self.whiteBV.mas_top).offset(19);
    }];
    
    _useType = [[UILabel alloc]init];
    _useType.font = [UIFont systemFontOfSize:15];
    _useType.textColor =kOrderBlack1;
    _useType.numberOfLines = 2;
    [self.whiteBV addSubview:_useType];
    [_useType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.whiteBV.mas_left).offset(19);
        make.right.mas_equalTo(self.whiteBV.mas_right).offset(-10);
        make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(5);
    }];
    
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
